﻿-- =============================================
-- Script Template
-- =============================================

-- DateBirth (Column 0)
Select convert(char(10),f._Fld1165,121) as DnRo,convert(char(10),Max (r._Period),121) As Period From _InfoRg5080 As r Left Join _Reference84 As s Inner Join _Reference101 As f On s._Fld993RRef = f._IDRRef On r._Fld5081RRef = s._IDRRef Where r._Fld5096RRef = 0xa4854b8d2b756bb24cf0d8eacc60b5d6 And s._Fld998RRef = 0x850666574703fd8a4f18c2299ebfad6a And s._Fld994 = 1 AND f._Code = '" + ID1C + "' Group By f._Code , f._Fld1165
-- DateArb (Column 1)
Select convert(char(10),f._Fld1165,121) as DnRo,convert(char(10),Max (r._Period),121) As Period From _InfoRg5080 As r Left Join _Reference84 As s Inner Join _Reference101 As f On s._Fld993RRef = f._IDRRef On r._Fld5081RRef = s._IDRRef Where r._Fld5096RRef = 0xa4854b8d2b756bb24cf0d8eacc60b5d6 And s._Fld998RRef = 0x850666574703fd8a4f18c2299ebfad6a And s._Fld994 = 1 AND f._Code = '" + ID1C + "' Group By f._Code , f._Fld1165


